<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>超级工具</title>
		<link rel="stylesheet" href="index.css">
		<script src='jquery-2.0.3.js'></script>
	</head>
	
	
	<body>
		
		
		
		
		<!-- 
			模式:传统网页开发
			说明:没有考虑任何封装,拓展的事情,仅自用,请勿随意转载,
			时长:两小时
		-->
		
		<!-- 计算器 -->
		
		
		<style>
			.showCount{
				width: 100px;height: 100px;background: #333333;color:#fff;text-align:center;line-height:100px;cursor:pointer;font-size: 50px;position: fixed;right:0;bottom:10px;z-index: 1;
			}
			
			.count-box{
				width:100%;
				height: 100%;
				position:fixed;
				left:0;
				top:0;
				background:rgba(0,0,0,.3);
				z-index: 0;
				display: flex;
				justify-content: center;
				align-items: center;
				
			}
			
			.hide{
				display: none;
			}
			.count-main{
				width:500px;
				height: 300px;
				background: #fff;
				
			}
			
			.count-result{
				height: 50px;
				width:450px;
				margin-left:25px;
				background: #ccc;
				/* border: 1px solid #ccc; */
			}
			.count-result input{
				width:450px;
				border:0;
				height: 50px;
				font-size:20px;
				background: #ccc;
				
			}
			
			.jieguo{
				margin: 20px 0;
				/* padding:30px; */
				font-size: 50px;
				text-align: center;
				border:0;
				outline: none;
			}
			
		</style>
		
		<div class='showCount' title='点击打开计算器'>
			计
		</div>
		
			
		<div class='count-box hide'>
			
			<div class='count-main'>
				
				<div style='text-align: center;padding:15px 0;font-size: 20px;'>一般计算器</div>
				
				<div class='count-result'>
					<input type="text" class='count-input' placeholder="请输入计算公式">
					
				</div>	
				
				<input type="text" class='jieguo' id='jieguo'>
				
				<input type="text" style='display: none;' id='count-result'>
				
				<button id='count-jieguo' style='width:450px;height: 50px;font-size:20px;margin-left:25px' >计算并复制结果</button>
					
				
			</div>
			
			
			
			
		</div>
		
		<script>
			
			$(function(){
				
				$('.showCount').click(function(e){
					$('.count-box').toggleClass('hide');
				});
				
				$('.count-input').change(function(){
					let result = parseFloat(eval($(this).val()));
					
					
					$('.jieguo').val(result);
				});
				
				
				$('#count-jieguo').click(function(){					
					var input = document.getElementById('jieguo');
					input.select(); // 选中文本
					document.execCommand("copy"); // 执行浏览器复制命令
				})
			});
			
		</script>
		
		
		<!-- <div class='showCount' title='点击打开定制器' style='width: 100px;height: 100px;background: #333333;color:#fff;text-align:center;line-height:100px;cursor:pointer;font-size: 50px;position: fixed;right:105px;bottom:10px;'>
			定
		</div> -->
		
		
		<style>
			body{
				display: flex;
				justify-content: center;
				align-items: center;
				height: 100vh;
			}
			.index{
				padding: 30px;
				border: 1px solid #eee;
				background: #f6f6f6;
				
			}
			.index-head{
				height: 50px;
				text-align: center;
				line-height: 50px;
				font-size:16px;
			}
			.index-body{
				margin:0 auto;
				background: #eee;
				min-height: 200px;
				width:1000px;
				padding:0 30px;
			}
			.input-item,.input-item-head{
				height:50px;
				display: flex;
				justify-content: space-between;
				align-items: center;
			}
			.input-item>div,.input-item-head>div{
				flex:1;
				text-align: center;
			}
			.input-item input{
				height: 50px;
				outline: none;
				font-size:20px;
				width:80px;
				height: 30px;
				text-align: center;
			}
			.input-old-result{
				color:red;
				font-size:16px;
				/* text-decoration: line-through; */
			}
			.input-new-result{
				color:red;
				font-size:22px;
			}
			.input-extra-result,.input-old-new-num-result,.input-bu-cha-jia-result{
				color:red;
				font-size:16px;
			}
			.index-foot{
				margin:0 auto;
				background: #eee;
				width:1000px;
				padding:30px;
			}
			
			.all-result span{
				color: red;
				font-size:22px;
			}
			.close{
				width:30px;
				height: 30px;
				text-align: center;
				line-height: 30px;
				box-sizing: border-box;
				border:1px solid #ccc;
				color: #333;
				cursor: pointer;
			}
		</style>
		
		<div class='index'>
			<div class="index-head">
				<div>电商计价工具</div>
			</div>
			
			<div class='index-body'>
				
				<div class='input-item-head'>
					<div>空</div>
					<div>型号</div>
					<div>数量(个)</div>
					<div>原价</div>
					<div>优惠价</div>
					<div>折扣(%)</div>
					
					<div>拍下量</div>
					<div>补差价</div>
					<div>原总价</div>
					<div>优惠额</div>
					
					<div>最后价</div>
					
				</div>
				
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				<div class='input-item'>
					<div class='close'>清空</div>
					<div class='input-spec'>
						<input type="text" >
					</div>
					<div class='input-number' >
						<input type="number" name='number'>
					</div>
					<div class='input-price' >
						<input type="number" name='old-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-price'>
					</div>
					<div class='input-price' >
						<input type="number" name='new-coupon' value='100'>
					</div>
					
					<div class='input-old-new-num-result'></div>
					<div class='input-bu-cha-jia-result'></div>
					<div class='input-old-result'></div>
					
					<div class='input-extra-result'></div>
					<div class='input-new-result'></div>
				</div>
				
				
				
				
			</div>
			
			<div class='index-foot'>
				
				<h3 style='text-align: center;'>订单金额:</h3>
				
				<div class='input-item-head'>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div></div>
					<div>原总价</div>
					<div>总差价</div>
					
					<div>最终订单价</div>
					
				</div>
				<div class='input-item'>
					<div class='input-spec'></div>
					<div class='input-number' >
						
					</div>
					<div class='input-price' >
					
					</div>
					<div class='input-price' >
						
					</div>
					<div class='input-price' >
						
					</div>
					<div class='input-old-new-num-result'> </div>
					<div class='input-bu-cha-jia-result'></div>
					
					<div class='input-old-result'><span class='all-old-price'>¥0</span></div>
					
					<div class='input-extra-result'><span class='all-extra-price'>¥0</span></div>
					<div class='input-new-result'><span class='all-new-price'>¥0</span></div>
				</div>
				
			
			</div>
						
			<style>
				.copy-box{
					margin-top:10px;
					display: flex;
					justify-content: space-around;
					align-items: center;
					
				}
				.copy-head,.copy-body{
					width:200px;
					height: 100px;
				}
				
			</style>
			
			
			<div class='copy-box'>
				<div>
					<div>句首定义</div>
					<textarea class='copy-head'>亲,您拍</textarea>
				</div>
				
				<div>
					<div>句尾定义</div>
					<!-- 您如果觉得可以,那就按上面的数量拍下 -->
					<textarea class='copy-body'></textarea>
				</div>
				
				<div>
					<div>最终结果</div>
					<textarea id='copy-text'  style='width:300px;height: 100px;'></textarea>
				</div>
							
				<button id='copy-index' style='margin-left:30px;width:100px;height: 50px;font-size:20px;' >复制</button>
				
			</div>
			
		</div>
		
		<style>
			.diy-box{
				width:300px;
				height: 650px;
				border:1px solid #eee;
				background:#F6F6F6;
			}
			.diy-head{
				height: 30px;
				line-height: 30px;
				text-align: center;
			}
			.diy-spec,.diy-type{
				width: 100%;
				text-align: center;
				outline: none;
				height: 30px;
				margin-top:5px;
				
			}
			.diy-width,.diy-height,.diy-price{
				margin-top:30px;
				display: flex;
				justify-content: space-between;
				align-items: center;
				/* padding:0 30px; */
				padding:0 15px;
			}
			.diy-width input,.diy-height input,.diy-price input{
				height: 30px;
				flex:1;
				font-size:20px;
				color: red;
				margin-left: 30px;
			}
			.diy-result{
				color: ;
			}
		</style>
		
		<!-- 定制 -->
		<div class='diy-box'>
			<div class='diy-head'>
				定制工具
			</div>
			<div class='diy-notice' style='color:red;line-height: 30px;line-height: 30px;text-align: center;'></div>
			<div class='diy-body'>
				<select class='diy-type'>
					<option value="6">面+0.06米</option>
					<option value="5">面+0.05米</option>
				</select>
				<select class='diy-spec'>
					<option value="">请选择规格</option>
				</select>
				
				<div class='diy-height'>
					<div>长度:</div>
					<input type="number" name='height'>
				</div>
				<div class='diy-width'>
					<div>宽度:</div>
					<input type="number" name='width'>
				</div>
				<div class='diy-width'>
					<div>基础:</div>
					<input type="number" name='default'>
				</div>
				<div class='diy-price'>
					<div>价格:</div>
					<input type="number" name='price'>
				</div>
				<div class='diy-price'>
					<div>运费:</div>
					<input type="number" name='ship_price' value='30'>
				</div>
				<div class='diy-result' style='padding:15px;font-size:20px;'>
					计算结果: <span style='color: red;'>0</span>
				</div>
				<textarea id='copy-diy' style='width:270px;height:100px;margin-left:15px;'></textarea>
				
				<button style='width:100px;height: 50px;font-size:20px;margin-left: 100px;' >复制</button>
				
			</div>
			
		</div>
		
		<!-- 定制工具 开始-->
		<script>
			
			$(function(){
				let spec006 = [
					{
						name:'方形散流器',
						sub:'(内径,天花开孔尺寸)',
						price:'420',
						coupon_price:'280',
						default:0.06
					},
					{
						name:'矩形散流器',
						sub:'(内径,天花开孔尺寸)',
						price:'440',
						coupon_price:'310',
						default:0.06
					},
					{
						name:'30度线形出风口',
						sub:'(内径,天花开孔尺寸)',
						price:'420',
						coupon_price:'300',
						default:0.06
					},
					{
						name:'固定小叶回风',
						sub:'(内径,天花开孔尺寸)',
						price:'420',
						coupon_price:'280',
						default:0.06
					},
					{
						name:'固定大叶回风',
						sub:'(内径,天花开孔尺寸)',
						price:'420',
						coupon_price:'280',
						default:0.06
					},
					{
						name:'双层可调百叶',
						sub:'(内径,天花开孔尺寸)',
						price:'450',
						coupon_price:'300',
						default:0.06
					},
					{
						name:'顶开式检修口',
						sub:'(内径,天花开孔尺寸)',
						coupon_price:'260',
						price:'390',
						default:0.06
					},
					{
						name:'门铰式检修口',
						sub:'(内径,天花开孔尺寸)',
						price:'420',
						coupon_price:'280',
						default:0.06
					},
					{
						name:'百叶检修口',
						sub:'(内径,天花开孔尺寸)',
						price:'480',
						coupon_price:'380',
						default:0.06	
					}
				];
				let spec005 = [
					{
						name:'ABS双层可调百叶',
						sub:'(内径,天花开孔尺寸)',
						price:'510',
						coupon_price:'340',
						default:0.05
					},
					{
						name:'ABS固定30度百叶',
						sub:'(内径,天花开孔尺寸)',
						price:'510',
						coupon_price:'340',
						default:0.05
					},
					{
						name:'ABS固定0度百叶',
						sub:'(内径,天花开孔尺寸)',
						coupon_price:'340',
						price:'510',
						default:0.05
					}
				];
				
				
				//复制
				function copyText(id) {
				      var text = document.getElementById(id).value;
				      var input = document.getElementById(id);
				      input.value = text; // 修改文本框的内容
				      input.select(); // 选中文本
				      document.execCommand("copy"); // 执行浏览器复制命令
				      
				}
				
				//类型 选择
				$('.diy-type').on('change',function(e){
					let type = $(this).find('option:checked').attr('value');
					reF5option(type);
					
					
					countDiy();
				
				});
				//规格 选择
				$('.diy-spec').on('change',function(e){
					// console.log($('option:selected',this).html().indexOf('检修口') !=-1);
					/* if($('option:selected',this).html().indexOf('检修口') !=-1){
						if($('input[name=width]').val()>0.6){
							$('input[name=width]').val(0.6)
						}
						if($('input[name=height]').val()>0.6){
							$('input[name=height]').val(0.6)
						}
						
						$('.diy-notice').text(' 检修口长或宽不能超过 600');
					}else{
						$('.diy-notice').text('');
					} */
					
					countDiy();
					
				});
			
				
				$('.diy-box').on('keyup','input[type=number]',function(e){
					
					/* if( $('.diy-type').val() == 6 && $('.diy-spec option:selected').html().indexOf('检修口') !=-1){
						
						if($('input[name=width]').val()>0.6 || $('input[name=height]').val()>0.6){
							$('.diy-notice').text(' 检修口长或宽不能超过 600');
							$(this).val(0.6);
						}
						
						
					}else{
						$('.diy-notice').text('');
					} */
					
					/* if(($('input[name=width]').val()>0.6|| $('input[name=height]').val()>0.6) && $('.diy-type').val() == 6){
						
						$('.diy-spec option').prop('selected',true);
						$('.diy-notice').text('长或宽已超过600,自动选择百叶检修口');
						
					}else{
						$('.diy-notice').text('');
					} */
					
					countDiy();
					
				});
				
				function countDiy(){
					let width = $('input[name=width]').val() || 0;
					width = parseFloat(width);
					
					let height = $('input[name=height]').val() || 0;
					height = parseFloat(height);
					
					
					let _default = $('input[name=default]').val() || 0;
					_default = parseFloat(_default);
					
					let ship_price = $('input[name=ship_price]').val() || 0;
					ship_price = parseFloat(ship_price);
					
					
					let area = parseFloat((width+_default)*(height+_default));
					
					// console.log(area);
					// console.log(area*price);
					if(area<=0.1){
						area = 0.1;
					}
					// 大于0.5
					if(area>=0.5){
						$('input[name=price]').val($('.diy-spec option:checked').attr('data-coupon_price'));
					}else{
						$('input[name=price]').val($('.diy-spec option:checked').attr('value'));
					}
					
					let price = $('input[name=price]').val() || 0;
					price = parseFloat(price);
					
					
					
					
					let result = parseFloat(area*price+ship_price).toFixed(2);
					
					$('.diy-result').html('计算价格为:<span style="color:red">'+result+'元</span>');
					
					let copy = '亲,您定制的'+width+'米*'+height+'米,加上运费,一共'+result+'元';
					
					$('#copy-diy').val(copy);
				}
				
				reF5option(6);
				function reF5option(type){
					let spec =[];
					
					// 模拟
					if(type == 6){
						spec = [...spec006];
					}else{
						spec = [...spec005];
					}
					let option = '';
					spec.forEach(function(v,i){
						
						option+='<option value='+v.price+' data-defualt='+v.default+' data-coupon_price='+v.coupon_price+'>'+v.name+'¥'+v.price+'<0.5㎡, ¥'+v.coupon_price+'>=0.5㎡</option>';
						
					});
					
					$('.diy-spec').html(option);
					
					
					$('input[name=price]').val(spec[0].price);
					$('input[name=default]').val(spec[0].default);
				}
				
				$('.diy-box').on('change','.diy-spec',function(e){
					let price = $(this).find('option:checked').attr('value');
					let _defualt = $(this).find('option:checked').attr('data-defualt');
					$('input[name=price]').val(price);
					$('input[name=default]').val(_defualt);
					countDiy();
				});
				
				$('.diy-box').on('click','button',function(e){
					copyText('copy-diy');
				});
				
			});
			
			
			
		</script>
		
		<!-- 定制工具完毕 -->
		<!-- 计价工具 开始-->	
		<script>
			
			$(function(){
				let copyTxt = $('.copy-head').val();
				//恢复上次记忆
				/* if(window.localStorage.copyHead){
					$('.copy-head').val(window.localStorage.copyHead);
				}
				if(window.localStorage.copyBody){
					$('.copy-head').val(window.localStorage.copyBody);
				}
				
				
				
				/* 句首 */
				/* $(document).on('change','.copy-head',function(e){
					let value = $(this).val();
					window.localStorage.copyHead = value;
					
				});
				
				$(document).on('change','.copy-body',function(e){
					let value = $(this).val();
					window.localStorage.copyBody = value;
					
				}); */ 
				
				$(document).on('click','.close',function(e){
					let parent = $(this).closest('.input-item');
					parent.find('input').val(null);
					parent.find('input[type=number]').first().trigger('keyup');
				});
				
				/* 非输入优惠折扣 */
				function countAll(){
					
					let all_old_price = 0;
					let all_new_price = 0;
					let all_extra_price = 0;
					let dom_old_price = $('.all-old-price');
					let dom_new_price = $('.all-new-price');
					let dom_extra_price = $('.all-extra-price');
					
					let all_chajia_price = 0;
					let count = 0;
					
					let all_math_equal = '';
					
					
						
					$('.index-body .input-item').each(function(v,i){
						
						let specName = $(this).find('.input-spec input').val()||'';
						let old_one_price = $(this).find('input[name=old-price]').val() || '';
						let new_one_price = $(this).find('input[name=new-price]').val() || '';
						let num = $(this).find('input[name=number]').val() || '';
						let new_num = $(this).find('.input-old-new-num-result').attr('data-new-num') || '';
						
						let old_price = $(this).find('.input-old-result').attr('data-old-price') || 0;
						let new_price = $(this).find('.input-new-result').attr('data-new-price') || old_price;
						let extra_price = $(this).find('.input-extra-result').attr('data-extra-price') || 0;
						
						// 差价
						let new_num_price = parseFloat(new_price-new_num*old_one_price).toFixed(2);
						 
						
						all_extra_price+=parseFloat(extra_price);
						all_old_price+=parseFloat(old_price);
						all_new_price+=parseFloat(new_price);
						
						if(all_new_price<0){
							all_new_price = 0;
						}
						
						if(specName&&old_one_price&&new_one_price&&num){
							
							copyTxt+=Math.floor(new_num)+'个'+specName+'的，';
							
							all_chajia_price+=parseFloat(new_num_price);
							
							all_math_equal+=num+'*'+new_one_price+'+';
									
							count+=1;
						}
						
					});
						
					
					
					
					dom_old_price.html('¥'+all_old_price);
					dom_new_price.html('¥'+all_new_price);
					dom_extra_price.html('¥'+all_extra_price);
					
					
					if(all_old_price==0 && all_new_price==0  ){
						return false;
					}
					// copyTxt+='\n总计给您申请优惠'+(all_extra_price<0?0:all_extra_price)+'元,'+'最终价为'+all_new_price+'元,实际拍为'+(all_new_price-all_chajia_price)+'元,需要补差价'+all_chajia_price+'元';
					
					all_math_equal  = all_math_equal.substr(0, all_math_equal.length - 1);						
					
					
					copyTxt+='剩下的差价我在邮费补上，一共支付'+all_math_equal+'='+all_new_price+'元。';
					
					
					copyTxt+='\n'+$('.copy-body').val();
										
					$('#copy-text').val(copyTxt);
					
					copyTxt = $('.copy-head').val();
					
				}
				
				
				
				$(document).on('keyup','.index-body input[type=number]',function(e){
					let parent = $(this).closest('.input-item');
					
					
					let dom_old_result = parent.find('.input-old-result')
					let dom_new_result = parent.find('.input-new-result');
					let dom_extra_result = parent.find('.input-extra-result');
					
					
					
					let num = parent.find('input[name=number]').val() || 0;
					let specName = parent.find('.input-spec input').val() || '';
					
					let old_price = parent.find('input[name=old-price]').val() || 0;
					
					//优惠折扣
					let new_coupon = parent.find('input[name=new-coupon]').val() || 100;
					let new_price = parent.find('input[name=new-price]').val() || old_price;
					
					if(e.target.name.toUpperCase().indexOf('COUPON') != -1){
						new_coupon = new_coupon/100;
						new_price =parseFloat(new_coupon*old_price).toFixed(2);
						parent.find('input[name=new-price]').val(new_price);
						
					}else{
						new_coupon = parseFloat(new_price/old_price).toFixed(4)*100;
						parent.find('input[name=new-coupon]').val(new_coupon);
					}
					
					
					
					let item_all_old_price = (num*old_price).toFixed(2);
					let item_all_new_price = (num*new_price).toFixed(2);
					
					
					let item_all_extra_price = (item_all_old_price-item_all_new_price).toFixed(2);
					
					if(item_all_new_price<0){
						item_all_new_price = 0;
					}
					
					dom_old_result.html('¥'+item_all_old_price).attr('data-old-price',item_all_old_price);
					dom_new_result.html('¥'+item_all_new_price).attr('data-new-price',item_all_new_price);;
					dom_extra_result.html('¥'+item_all_extra_price).attr('data-extra-price',item_all_extra_price);;
					
					
					// 同等原价下需要拍下的数量
					let new_num = parseFloat(item_all_new_price/old_price).toFixed(2) || 0;
					parent.find('.input-old-new-num-result').html(new_num+'个').attr('data-new-num',Math.floor(new_num));
					
                     //补差价
					let buchajia = new_num - Math.floor(new_num);
					buchajia = parseFloat(item_all_new_price-( Math.floor(new_num)*old_price)).toFixed(2);
					parent.find('.input-bu-cha-jia-result').html('￥'+buchajia);

					console.log(e.target.name.toUpperCase());
					
					
					countAll();
					
					
					
				
				});
				
				//复制
				function copyText(id) {
				      var text = document.getElementById(id).value;
				      var input = document.getElementById(id);
				      input.value = text; // 修改文本框的内容
				      input.select(); // 选中文本
				      document.execCommand("copy"); // 执行浏览器复制命令
				      
				}
				
				
				$(document).on('click','#copy-index',function(e){
					copyText('copy-text');
				});
				
				
				
			});
			
		</script>
		
		<!-- 计价工具 结束-->	
	</body>
</html>
